﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Coding4Fun.FakeCall.Data;

namespace Coding4Fun.FakeCall.Controls
{
	public partial class PhoneInfo : UserControl
	{
		public PhoneInfo()
		{
			DataContext = this;
			Settings = FakeCallSettings.Instance;

			InitializeComponent();
		}

		private FakeCallSettings _settings;
		public FakeCallSettings Settings
		{
			get { return _settings; }
			set
			{
				_settings = value;
				RaisePropertyChanged("Settings");
			}
		}

		#region INotifyPropertyChanged Members

		public event PropertyChangedEventHandler PropertyChanged;

		protected void RaisePropertyChanged(string propertyName)
		{
			if (PropertyChanged != null)
			{
				PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
		#endregion


		private bool _forceLightTheme;
		public bool ForceLightTheme
		{
			get { return _forceLightTheme; }
			set
			{
				_forceLightTheme = value;
				if (!_forceLightTheme)
					return;

				signal.Source = new BitmapImage(new Uri(string.Format(signal.DataContext.ToString(), "dark"), UriKind.Relative));
				battery.Source = new BitmapImage(new Uri(string.Format(battery.DataContext.ToString(), "dark"), UriKind.Relative));
				time.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255));
			}

		}

		private bool _showTime = true;
		
		public bool ShowTime
		{
			get { return _showTime; }
			set 
			{
				_showTime = value;

				time.Opacity = _showTime ? 1 : 0;
			}
		}
	}
}
